Repository navigation
Conversation
) Experimental API under Workflow\V2\EntityReferences, following the decisions on #996: EntityReferenceAdapter (supports/identify/version), EntityReferenceResolver (resolve with a trusted EntityReferenceContext), the portable EntityReference {type, id, version}, EntityNotFound / EntityAccessDenied for resolvers, and the non-retryable EntityReferenceRefused (unknown type, unsupported version, parameter mismatch). Registration is workflows.v2.entity_references by logical type. V2EntityReferenceTest pins the accepted behavior with a plain Order entity: the activity receives the current persisted entity, history records {type, id, version} plus entity_reference_positions, replay never resolves, a missing entity fails with EntityNotFound, an unknown recorded type is refused non-retryably before the activity runs, and an unregistered object still fails. The first four fail until the implementation lands; this is a draft. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Workflow owns the implementation on this draft. The failing behavior tests are intentional API-first evidence, not a finished implementation or a merge candidate. I reviewed the accepted scope and current head Next source action after the active #863 Security corrections: encode registered top-level arguments as portable references with recorded positions, then resolve only at real queue/local activity attempts using trusted context. Plain maps, retry reload, resolver failures, version/parameter mismatch and resolver-free replay remain required before this leaves draft. No contributor implementation or feedback is required to start that work. |
|
An implementation-preparation fix is now on this draft: Seven focused controls pass (10 assertions): reordered valid keys, missing/extra/substituted fields, a string version, empty identifier and non-positive version. ECS and static analysis pass on the changed files. The runtime adapter/resolver behavior remains unimplemented and the feature tests remain the existing API-first draft work; this is not a merge or delivery claim. The runtime implementation also needs to preserve Laravel dependency injection around referenced arguments and keep resolver calls outside replay. Those remain part of the upcoming queue/local activity slice. |
|



The next step on #996 (chrom's request, design accepted on 2026-11-03/04): a draft with the adapter/resolver API and failing tests. Implementation follows on this PR.
API (experimental,
Workflow\V2\EntityReferences)EntityReferenceAdapter:supports(object),identify(object): string,version(): int. Registered per logical type. The domain class implements nothing.EntityReferenceResolver:resolve(EntityReference, EntityReferenceContext): object. It runs before each attempt with trusted context (namespace, run, activity, attempt, argument position, declared parameter type). A tenant inside a reference is never trusted on its own.EntityReference{type, id, version}is an ordinary Avro map, so the value schema is unchanged and arguments without references stay byte-identical.EntityReferenceRefused(unknown type, unsupported version, parameter mismatch) is non-retryable and raised before the activity runs;EntityNotFoundandEntityAccessDenied, which follow the activity's retry policy;workflows.v2.entity_referencesmaps'orders.order' => ['adapter' => …, 'resolver' => …].Behavior pinned by
V2EntityReferenceTest(4 fail until implemented)new Order(…). History stores[{type: orders.order, id, version: 1}, 'checked']plusentity_reference_positions: [0]on the execution and onActivityScheduled. The activity receives the current persistedOrderin its typed parameter.WorkflowReplayer) never calls the resolver.EntityNotFound.Still to add with the implementation: ordinary arrays that match the shape are never resolved; a version mismatch; a parameter type mismatch; per-attempt current-state reload on retry; a local-activity path; docs.
Scope (from the decision)
In scope: top-level activity arguments for in-process V2 workers (queue and local activities). Out of scope: nested references, collections, results, workflow arguments, and other SDKs.
🤖 Generated with Claude Code